const express = require('express');
var dishController = require('../controller/dish.controller');

module.exports = function (app) {
    var router = express.Router();

    router.route('/byDid/:did')
        .get(dishController.findById);

    router.route('/byType/:type')
        .get(dishController.findByType);

    router.route('/byName/:name')
        .get(dishController.findByName);

    router.route('/both/:type/:name')
        .get(dishController.findByBoth);

    router.route('/')
        .get(dishController.findAll)
        .post(dishController.addDish);

    router.route('/update')
        .post(dishController.updateDish);

    router.route('/:id')
        .delete(dishController.deleteDish);

    app.use('/sec/op/dishes', router);

    return router;
};